<?php

function confirmsignup($email) {
    //opening connection
    $conn = mysql_connect('localhost', 'root', '') or die(mysql_error());
    mysql_select_db('mydb') or die(mysql_error());
    //email subject 
    $subject = 'Confirmation mail';
    // a query to get memberid 
    $myquery = mysql_query("
         SELECT `member_id`
         FROM `member`m
         WHERE m.`email`=$email
         ") or die(mysql_error());
    
  
    // fetching the memberid
    $myrow = mysql_fetch_assoc($myquery);
    // saving the member id in a  variable
    $member_id = $myrow["member_id"];
    

    // the email message which redirects to the member's homepage  
    $message = <<<EMAIL
    
Please comfirm your account through This Link:
http://localhost:1234/ConfO/userHomepage.php?member_id='$member_id'}


EMAIL;
    //the email header
    $from = 'marmarwalid@hotmail.com';
    $headers = "From:" . $from;
    mail($email, $subject, $message, $headers);
    // alerting the user that he has to confirm his account 
    echo '<script type="text/javascript">',
    'alert("Please confirm your account through your email");',
    '</script>';
    mysql_close($conn);
    
}

?>
